package com.zhu.char07

/**
 *
 * @version 1.0
 * @author study
 * @date 2020/9/5 20:57
 *
 */
object Scala_TestFun02 {
  def main(args: Array[String]): Unit = {
    val list: List[Int] = List(5, 8, 1, 2, 3, 4)

    //求和
    list.sum

    //求乘积
    list.product

    list.max

    //排序
    //默认升序，
    list.sorted
    //
    list.sortBy(ele => ele)
    list.sortBy(ele => -ele)

    //降序
    println(list.sortWith((a, b) => a > b))
    println(list.sortWith(_ < _)) //升序
  }
}
